extends Camera2D


# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var hole
var idle_circle
onready var SHIP = find_parent("SHIP")
onready var screen_diagonal = get_viewport().size.length()
var zoom_target = 1.0
var zoom_factor = 1.0
# Called when the node enters the scene tree for the first time.
func _ready():
	hole = Circle.new(SHIP.MIN_RADIUS * screen_diagonal)
	hole.color = ColorN("black")
	hole.invert_enable = true
	hole.invert_border = 2000
	hole.visible = false
	hole.z_index = 4
	add_child(hole)
	
	idle_circle = CircleOutline.new(SHIP.MIN_RADIUS * screen_diagonal)
	
	idle_circle.default_color = Color8(255,255,255,100)
	idle_circle.width = 3
	idle_circle.visible = false
	idle_circle.z_index = 3
	add_child(idle_circle)

func _process(delta):
	if SHIP.mouse_active and Input.is_mouse_button_pressed(1) and not SHIP.gameover:
		zoom_target = 2.0
	else:
		zoom_target = 1.0
	zoom_factor += (zoom_target - zoom_factor)*0.1
	scale = Vector2.ONE*zoom_factor
	zoom = Vector2.ONE*zoom_factor
